export function useDebunce<T extends (...args: any[]) => any>(
  callback: T, 
  delay: number = 400
): (...args: Parameters<T>) => void {
  let timer: number | null = null;
  return function(this: any, ...args: Parameters<T>) {
    if (timer) {
      clearTimeout(timer);
    }
    timer = window.setTimeout(() => {
      callback.apply(this, args);
    }, delay);
  };
}